/**
 * @author:cavion(曹仁道)
 * @email:caorendao187@163.com
 * 2016年8月27日 
 */
package org.rk.core.common.bean;

import java.sql.Timestamp;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;
import org.rk.core.common.anno.FieldMeta;
import org.rk.core.common.util.RKDateUtil;
import org.rk.core.common.util.RkObjectUtil;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * @author:cavion
 * @描述：
 * 2016年8月27日 下午3:27:18
 */
public class BaseBean extends CoreBean{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4529104675909049106L;
	
	@NotNull(message="创建人不可为空")
	@NotBlank
	@FieldMeta(name="creator",isUpdate=false)
	private String creator;
	
	@NotNull(message="创建时间不可为空")
	@NotBlank
	@FieldMeta(name="createTime",isUpdate=false)
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Timestamp createTime;
	
	@FieldMeta(name="updator",isInsert=false)
	private String updator;
	
	@FieldMeta(name="updateTime",isInsert=false)
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Timestamp updateTime;
	
	public String getCreator() {
		return creator;
	}
	public void setCreator(String creator) {
		this.creator = creator;
	}
	public String getUpdator() {
		return updator;
	}
	public void setUpdator(String updator) {
		this.updator = updator;
	}
	public Timestamp getCreateTime() {
		if(RkObjectUtil.isEmpty(createTime)){
			return RKDateUtil.getCurrentTimestamp();
		}
		return createTime;
	}
	public void setCreateTime(Timestamp createTime) {
		if(RkObjectUtil.isEmpty(createTime)){
			this.createTime=RKDateUtil.getCurrentTimestamp();
		}else{
			this.createTime = createTime;
		}
	}
	public Timestamp getUpdateTime() {
		if(RkObjectUtil.isEmpty(updateTime)){
			return RKDateUtil.getCurrentTimestamp();
		}
		return updateTime;
	}
	public void setUpdateTime(Timestamp updateTime) {
		if(RkObjectUtil.isEmpty(updateTime)){
			this.updateTime=RKDateUtil.getCurrentTimestamp();
		}else{
			this.updateTime = updateTime;
		}
	}
	
	
}
